// pages/serialPage/serialPage.js
var app = getApp();
var com = require('../../common.js');
Page({
  data: {
    id: "",
    type: false
  },
  onLoad: function(options) {
    var _this = this
    _this.setData({
      id: options.id
    })
    _this.onInfoList()
  },
  onReady: function() {},
  onShow: function() {},
  onHide: function() {},
  onUnload: function() {},
  onPullDownRefresh: function() {},
  onReachBottom: function() {},
  // onShareAppMessage: function() {},
  onInfoList() {
    var _this = this
    com.link(app.link.settlementId + _this.data.id + '.st', {}, function(rep) {
      console.log(rep)
      if (rep.data.data.settlement_type.substring(rep.data.data.settlement_type.length - 1, rep.data.data.settlement_type.length) == 'r') {
        console.log('订单', rep.data.data.settlement_type.substring(0, 1))
        _this.setData({
          info: rep.data.data,
          type:true
        })
      } else {
        console.log('优惠券', rep.data.data.settlement_type.substring(rep.data.data.settlement_type.length - 1, rep.data.data.settlement_type.length))
        _this.setData({
          info: rep.data.data,
          type:false
        })
      }
      _this.setData({
        info: rep.data.data
      })
    }, "GET")
  },
})